<div class="adPosts myAds">
<h2><?php __('My Ads') ;?></h2>
<p>
<?php
echo $paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?></p>
<table cellpadding="5" cellspacing="0" style="font-size:12px;">
<tr>
	<th><?php echo $paginator->sort(__('Id',true), 'id');?></th>
	<th align="left"><?php echo $paginator->sort(__('Category',true), 'ad_category_id');?></th>
	<th><?php echo $paginator->sort(__('Type',true), 'type');?></th>
	<th><?php echo $paginator->sort(__('Title',true), 'title');?></th>
	<th><?php echo $paginator->sort(__('Price',true), 'price');?></th>
	<th><?php echo $paginator->sort(__('Area',true), 'location_id');?></th>
	<th><?php echo $paginator->sort(__('Image',true), 'ad_image_id');?></th>
	<th><?php echo $paginator->sort(__('Publish',true), 'active');?></th>
	<th><?php echo $paginator->sort(__('Created',true), 'created');?></th>
	<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($adPosts as $adPost):
	$class = null;
	if ($i++ % 2 == 0) {
		$class = ' class="altrow"';
	}
?>
	<tr<?php echo $class;?>>
		<td>
			<?php echo $adPost['AdPost']['id']; ?>		</td>
		<td style="padding:2px; text-align:left">
			<?php __($adPost['AdCategory']['category']); ?>		</td>
		<td>
			<?php ($adPost['AdPost']['type'] == 'W') ? __('Wanted') : __('Offer'); ?>		</td>
		<td>
			<?php echo $adPost['AdPost']['title']; ?>		</td>
		<td>
            <?php echo $adPost['AdPost']['currency']; ?>
            <?php echo $adPost['AdPost']['price']; ?>		</td>
		<td>
			<?php __($adPost['Location']['name']); ?>		</td>
		<td style="padding:5px">
        <?php  if ($adPost['DefaultImage']['filename']) { ?>
          <center><img src="<?php e($this->base.'/img/images/s_'.$adPost['DefaultImage']['filename']); ?>" /></center>
        <?php  } ?>		</td>
		<td>
			<?php ($adPost['AdPost']['active']) ? __('Yes') : __('No'); ?>		</td>
		<td>
			<?php echo $adPost['AdPost']['created']; ?>		</td>
		<td class="actions" style="padding:5px 0;">
			<?php echo $html->link(
			    $html->image('view.png', array('alt'=>__('View',true))),
				'/adPosts/view/'.$adPost['AdPost']['id'],
				array('style'=>'background-color:transparent; padding:1px;'),
				null, null, false
			); ?><span class="actions" style="padding:5px 0;"><?php echo $html->link(
			    $html->image('edit.png', array('alt'=>__('Edit',true))),
				'/adPosts/edit/'.$adPost['AdPost']['id'],
				array('style'=>'background-color:transparent; padding:1px;'),
				null, null, false
			); ?></span><?php echo $html->link(
			    $html->image('delete.gif', array('alt'=>__('Delete',true))),
				'/adPosts/delete/'.$adPost['AdPost']['id'],
				array('style'=>'background-color:transparent; padding:1px;'),
				sprintf(__('Are you sure you want to delete # %s?', true),
				$adPost['AdPost']['id']),
				false
			); ?>		</td>
	</tr>
<?php endforeach; ?>
</table>
</div>
<div class="dl paging">
	<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
 | 	<?php echo $paginator->numbers();?>
	<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?>
</div>
<div class="dr" style="margin-right:5px;">
<strong>Legend: </strong> &nbsp;
<?php echo $html->image('view.png', array('style'=>'margin-bottom:-4px')); ?> View &nbsp;&nbsp; 
<?php echo $html->image('edit.png', array('style'=>'margin-bottom:-3px')); ?> Edit &nbsp;&nbsp;
<?php echo $html->image('delete.gif', array('style'=>'margin-bottom:-4px')); ?> Delete						
</div>